<?php 
namespace app\home\controller;
use app\home\model\Article;
use think\Controller;
/**
* 文章列表
*/
class Artlist extends Common
{
	
	public function index(){
		$article=new \app\home\model\Article();
        $cateid=input('cateid');
        $artRes=$article->getAllArticles($cateid);//当前栏目下的所有文章
        $cateRes=db('category')->where(array('cid'=>$cateid))->select();//当前栏目
          foreach ($cateRes as $k => $v) {
            $children=db('category')->where(array('pid'=>$v['cid']))->select();
                // $cateRes['children']=$children;
           
        }

        $this->assign(array(
            'artRes'=>$artRes,
            'cateRes'=>$cateRes,
            'children'=>$children,
            ));
		return $this->fetch('artlist');
	}
}


